package cn.lili.controller.feign;

import cn.lili.common.utils.SpringContextUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.kit.CashierSupport;
import cn.lili.modules.kit.Payment;
import cn.lili.modules.kit.RefundSupport;
import cn.lili.modules.payment.client.PaymentClient;
import cn.lili.modules.payment.client.PaymentDataClient;
import cn.lili.modules.payment.entity.dos.*;
import cn.lili.modules.payment.entity.dto.*;
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
import cn.lili.modules.payment.entity.vo.OutOrderLogVO;
import cn.lili.modules.payment.sentine.PaymentSentinelHandler;
import cn.lili.modules.payment.service.CombinePaymentLogService;
import cn.lili.modules.payment.service.PaymentDataService;
import cn.lili.modules.payment.service.PaymentLogService;
import cn.lili.modules.payment.task.PaymentEveryDayTask;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付 feign client
 *
 * @author Chopper
 * @version v1.0 2021-12-07 19:07
 */
@RestController
@RequiredArgsConstructor
public class PaymentDataFeignController implements PaymentDataClient {

    private final PaymentDataService paymentDataService;

    @Override
    public PaymentData getPaymentDataBySn(String orderNo) {
        LambdaQueryWrapper<PaymentData> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PaymentData::getOrderSn, orderNo);
        queryWrapper.orderByDesc(PaymentData::getCreateTime);
        return paymentDataService.getOne(queryWrapper);
    }
}
